Carregando os pacotes

library(terra)
## terra 1.7.83
library(sf)
## Linking to GEOS 3.8.0, GDAL 3.0.4, PROJ 6.3.1; sf_use_s2() is TRUE
library(leaflet)

Leitura dos dados

agri_poll <- sf::st_read("../croplands-classification/data/derived/SENTINEL-2_MSI_028022_2021-06-26_2021-06-26_class_masked-bin.json")
## Reading layer `SENTINEL-2_MSI_028022_2021-06-26_2021-06-26_class_masked-bin' from data source `/home/sits/cap-423/croplands-classification/data/derived/SENTINEL-2_MSI_028022_2021-06-26_2021-06-26_class_masked-bin.json' 
##   using driver `GeoJSON'
## Simple feature collection with 2 features and 2 fields
## Geometry type: MULTIPOLYGON
## Dimension:     XY
## Bounding box:  xmin: 5580800 ymin: 9524800 xmax: 5686400 ymax: 9630400
## Geodetic CRS:  WGS 84
agri_poll

Visualização dos dados

plot(agri_poll)

Visualização interativa com leaflet

Reprojeção para WGS 84

sf::st_crs(agri_poll) <- "+proj=aea +lat_0=-12 +lon_0=-54 +lat_1=-2 +lat_2=-22 +x_0=5000000 +y_0=10000000 +ellps=GRS80 +units=m +no_defs"

agri_poll <- sf::st_transform(agri_poll, 4326)

Filtrando somente os poligonos de agricultura e usando o Leaflet para visualizar.

agri_poll <- agri_poll[agri_poll$label == "Agricultura",]

leaflet(agri_poll) |>
  addTiles() |> 
  addPolygons(popup = ~label)
2024 - CAP-423